import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        loadingTimer: null,
        count: 1,
        loading: false,
        qiniuDomain: 'http://polowgzbk.bkt.clouddn.com/'
        
    },
    mutations: {
        setQiniuDomain (state, qiniuDomain) {
            state.qiniuDomain = qiniuDomain;
        },
        showLoading (state) {
            clearTimeout(state.loadingTimer)
            state.loading = true
        },
        hiddenLoading (state) {
            state.loading = true
            clearTimeout(state.loadingTimer)
            state.loadingTimer = setTimeout(() => {
                state.loading = false
            }, 100);
        }
    }
})